@extends('admin.common.main')

@section('cnt')
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span> 角色管理
        <span class="c-gray en">&gt;</span> 修改角色
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>


    <article class="page-container">
        {{--引用验证--}}
        @include('admin.common.validate')
        @include('admin.common.msg')

        <form action="{{ route('admin.role.update',$data) }}" method="post" class="form form-horizontal" id="form-role-edit">
            @method('PUT')
            @csrf
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色id：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" disabled value="{{$data->id}}" placeholder="" id="role_id" name="id">
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色名：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="{{$data->role_name}}" id="role_name" name='role_name'>
                </div>
            </div>



            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>
@endsection

@section('js')
    <script type="text/javascript" src="{{env('APP_URL')}}admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="{{env('APP_URL')}}admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="{{env('APP_URL')}}admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script>
        $(function () {
            $("#form-role-edit").validate({
                rules:{
                    role_name:{
                        required:true,
                        minlength:2,
                        maxlength:30
                    },
                },
                onkeyup:false,
                focusCleanup:true,
                success:"valid",
                submitHandler:function(form){
                    form.submit();
                }
            });
        });
    </script>
@endsection
